<include file="Common@Backend/header" />
	<!-- page heading start-->
    <div class="page-heading">
        <h3>
            {$breadcrumb.A}
        </h3>
        <ul class="breadcrumb">
            <li>
                {$breadcrumb.M}
            </li>
            <li>
                {$breadcrumb.C}
            </li>
            <li class="active"> {$breadcrumb.A}  </li>
        </ul>
    </div>
    <!-- page heading end-->
	
    <!--body wrapper start-->
    <div class="wrapper">
        <div class="row">
            <div class="col-lg-12">
                <section class="panel">
                    <header class="panel-heading">
                        添加分类
                    </header>
                    <div class="panel-body">
                        <form role="form" action="{$action}" method="post" id="form">
                            <input type="hidden" name="id" value="{$id}">
                            <div class="form-group">
                                <label for="name">分类名称</label>
                                <input type="text" name="name" class="form-control" id="name" placeholder="输入分类名" value="{$category.name}">
                            </div>
                            <div class="form-group">
                                <label for="sku">上级分类</label>
                                <select name="pid" class="form-control">
                                    <option value="0">[顶级分类]</option>
                                    {$optionStr}
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="keyword">关键词</label>
                                <input type="text" name="keyword" class="form-control" id="keyword" placeholder="输入关键词" value="{$category.keyword}">
                            </div>
                            <div class="form-group">
                                <label for="description">描述</label>
                                <textarea class="form-control" rows="5" name="description" id="description" value="{$category.description}"></textarea>
                            </div>
                            <div class="form-group">
                                <label for="status">分类状态</label>
                                <select class="form-control m-bot15" id="status" name="status">
                                    <if condition="category.status eq 1">
                                    <option value="1" selected="selected">启用</option>
                                    <option value="0">关闭</option>
                                    <else/>
                                    <option value="1">启用</option>
                                    <option value="0" selected="selected">关闭</option>
                                    </if>
                                </select>
                            </div>
                            <button type="submit" class="btn btn-primary">保存</button>
                            <a href="{$cancel}" class="btn btn-primary">取消</a>
                        </form>
                    </div>
                </section>
                <!-- 提交表单 -->
                <script type="text/javascript">
                    $('#form').on('submit',function(){
                        $.ajax({
                            type:'post',
                            url:$('#form').attr('action'),
                            data:$('#form').serialize(),
                            dataType:'json',
                            success:function(data){
                                if(data.status=='OK'){
                                    window.location=data.url;
                                }else{
                                    alert(data.msg);
                                }
                            }
                        });
                        return false;
                    });
                </script>
            </div>
        </div>
    </div>
    <!--body wrapper end-->
<include file="Common@Backend/footer" />